<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@ page language="java" import="com.tjtt.common.utils.DateUtilsAll"%>
<%@ taglib prefix="s" uri="/struts-tags"%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://"
			+ request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
%>
<%@ taglib uri="/struts-tags" prefix="s"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<base target="_self" />
<link rel="stylesheet" type="text/css"
	href="<%=path%>/web/style/layout.css" />
<script type="text/javascript"
	src="<%=path%>/jqGrid/js/jquery-1.7.2.min.js"></script>
<script type="text/javascript"
	src="<%=path%>/jslib/jquery.validate.min.js"></script>
<script type='text/javascript'
	src="<%=request.getContextPath()%>/jslib/My97DatePicker/WdatePicker.js"
	defer="defer"></script>
<script type='text/javascript'
	src="<%=request.getContextPath()%>/jslib/jquery.form.js"></script>
<script type="text/javascript"
	src="<%=request.getContextPath()%>/jslib/additional-methods.js"></script>
<link rel="stylesheet" type="text/css"
	href="<%=request.getContextPath()%>/jslib/jquery-easyui-1.4.1/themes/default/easyui.css">
<link rel="stylesheet" type="text/css"
	href="<%=request.getContextPath()%>/jslib/jquery-easyui-1.4.1/themes/icon.css">
<link rel="stylesheet" type="text/css"
	href="<%=request.getContextPath()%>/jslib/jquery-easyui-1.4.1/demo.css">
<script type="text/javascript"
	src="<%=request.getContextPath()%>/jslib/jquery-easyui-1.4.1/jquery.easyui.min.js"></script>
<c:if test="${requestScope.message!=null}">
	<script type="text/javascript">
 	 		     alert('<c:out value="${requestScope.message}"></c:out>');
 	 		     window.close();
 		</script>
</c:if>

<script type="text/javascript">
    var api = frameElement.api, W = api.opener;
    var stateValue="";
    $().ready(function(){
			var options = {
					 url:'<%=request.getContextPath()%>/Shebeifengcun!chuliShebei2.action?steptype='+$("#steptype0").val()+'&taskinfoid='+${taskinfoid},
			  	     beforeSubmit: function() {
			   				return  checking();
			    			},
			  	    dataType:'json',
			  	    success: function(data) {
			  	    //alert(data);
			  	      if(data.result=='success'){
						alert("提交成功");
					//	window.close();
						W.reload();
						api.close();

			  	      }
			  	    }};
			
			
			
		$('#saveBtn').click(function(){
			$('#pageFrom').ajaxSubmit(options);
		/* 	var CHUZHI = $("#CHUZHI").val();
			var mark = $('input:radio:checked').val();
			if(mark =="step11" || CHUZHI == "启用" ){
				
				$(".fselect").val("封存");
	    		return false;
			}
			if(mark =="step16" || CHUZHI == "封存" ){
				
				$(".fselect").val("启用");
	    		return false;
			} */
		
	 	      return false;
    	 });
    	$('#closeBtn').click(function(){
    		api.close();
			//window.close();
		});
		
	});
	
   	function checking(){
   		var CHUZHI = $("#CHUZHI").val();
   		var flag = true;
   	  	var mark = $('input:radio:checked').val();
   	 	var shenqinren = $("#SHENQINREN").val();
		var shenpiren = $("#SHENPIREN").val();
		
		var flowname = $.trim($("#flowname").val());
		
		if(mark =="step11" && CHUZHI == "启用" ){
			alert("设备处置类型不一致")
			//$(".fselect").val("封存");
    		return false;
		}
		if(mark =="step16" && CHUZHI == "封存" ){
			alert("设备处置类型不一致")
			//$(".fselect").val("启用");
    		return false;
		}
		
	
		
		if(shenqinren ==null || shenqinren == "" ){
			alert("申请人不能为空！");
			$("#shenqinren").focus();
    		return false;
		}
		if(shenpiren == null && shenpiren == ""){
			alert("审批人不能为空！");
			$("#shenpiren").focus();
    		return false;
		}
		if(flowname ==null || flowname == "" ){
			alert("流程名称不能为空！");
			$("#flowname").focus();
			return false;
		}
		
		
	}
	 
	
	function countlen1(textarea){
	       var elem = event.relatedTarget || event.srcElement || event.target ||event.currentTarget;    
	        if(event.keyCode!=8)
			{
			  if (textarea.value.length> 249){
			        alert("最多为250个字符,字符输入超出限制!");
			        textarea.value=textarea.value.substring(0,249);
			    }
			    return true;
	 	    }
	}
		
	

	

   	</script>
<style type="text/css">
body {
	background: #ffffff;
	background-image: url(images/);
}

html {
	overflow-x: hidden;
	overflow-y: hidden;
}

.formTableNew textarea {
	border: 1px solid #999;
	padding: 5px;
	width: 760px;
	-moz-border-radius: 3px;
	border-radius: 3px;
	margin-bottom: 5px;
	color: #666;
	background: url(../images/input_bg.gif) repeat-x top;
}
</style>
</head>

<body>
	<form id="pageFrom" action="" enctype="multipart/form-data"
		method="post">
		<input type="hidden" id="flag" name="flag" /> <input type="hidden"
			name="flowid" id="flowid" value="${flowid}"> <input
			type="hidden" name="stateid" id="stateid" value="${stateid}">
		<input type="hidden" name="fengcunid" id="fengcunid"
			value="${requestScope.id}"> ${steptcontent}
		${steptcontentback } <input type="hidden" name="shebeiid"
			id="shebeiid" value="${shebeifengcun.ID}">

		<table width="100%" border="0" align="center" cellpadding="5"
			cellspacing="5" class="formTableNew">
			<tr>
				<td align="right">流程名称:</td>
				<td><input type="text" id="flowname" name="flowname"
					readonly="readonly" maxlength="50" value="${flowname}"
					style="border: 1px solid #999;padding: 5px;width: 250px;height:25px;" />
					<img src="<%=request.getContextPath()%>/images/xh.png"
					align="absmiddle"></img></td>
			</tr>
			<tr>
				<td align="right">设备名称：</td>
				<td align="left"><input type="text" id="EQUNAME" maxlength="50"
					name="EQUNAME" readonly="readonly"
					style="border: 1px solid #999;padding: 5px;width: 250px;height:25px;"
					value="${shebeifengcun.EQUNAME}" /> <input type="hidden" id="ID"
					maxlength="50" name="ID" /> <img
					src="<%=request.getContextPath()%>/images/xh.png" align="absmiddle"></img>
				</td>
				<td align="right">设备编号：</td>
				<td align="left"><input type="text" id="EQUNO"
					readonly="readonly" maxlength="50" name="EQUNO"
					style="border: 1px solid #999;padding: 5px;width: 250px;height:25px;"
					value="${shebeifengcun.EQUNO}" />
			</tr>
			<tr>
				<td align="right">规格型号：</td>
				<td align="left"><input type="text" id="EQUGUGE"
					readonly="readonly" maxlength="50" name="EQUGUGE"
					style="border: 1px solid #999;padding: 5px;width: 250px;height:25px;"
					value="${shebeifengcun.EQUGUGE}" /></td>
				<td align="right">部门：</td>
				<td align="left"><input type="text" id="EQUORGNAME"
					readonly="readonly" maxlength="50" name="EQUORGNAME"
					style="border: 1px solid #999;padding: 5px;width: 250px;height:25px;"
					value="${shebeifengcun.EQUORGNAME}" /></td>
			</tr>
			<tr>
				<td align="right">存放地点：</td>
				<td align="left"><input type="text" id="CFANGDIDIAN"
					maxlength="50" readonly="readonly" name="CFANGDIDIAN"
					style="border: 1px solid #999;padding: 5px;width: 250px;height:25px;"
					value="${shebeifengcun.CFANGDIDIAN}" /></td>
				<td align="right">封存截止日期：</td>
				<td align="left"><input type="text" id="FENGCUNJIEZHI"
					name="FENGCUNJIEZHI" readonly="readonly"
					style="border: 1px solid #999;padding: 5px;width: 250px;height:25px;"
					value="${shebeifengcun.FENGCUNJIEZHI}" /></td>
			</tr>
			<tr>
				<td align="right">提前提醒天数：</td>
				<td align="left"><input type="text" id="TIXING" name="TIXING"
					readonly="readonly"
					style="border: 1px solid #999;padding: 5px;width: 250px;height:25px;"
					value="${shebeifengcun.TIXING}" /></td>
				<td align="right">处置类型：</td>
				<td align="left">	
				<select id="CHUZHI" class='fselect' name="CHUZHI" class='easyui-validatebox' style="border: 1px solid #999;padding: 5px;width:250px;height:25px;" >
 			      <option value="封存">封存</option>
			 	  <option value="启用">启用</option>
 			    </select>
 			    </td>
			</tr>
			<tr>
				<td align="right">申请人：</td>
				<td align="left"><input type="text" id="SHENQINREN"
					readonly="readonly" maxlength="50" name="c"
					style="border: 1px solid #999;padding: 5px;width: 250px;height:25px;"
					value="<%=session.getAttribute("username")%>" /></td>
				<td align="right">申请日期 :</td>
				<td align="left"><input type="text" id="SQDATE" maxlength="50"
					readonly="readonly" name="SQDATE"
					style="border: 1px solid #999;padding: 5px;width: 250px;height:25px;"
					value="<%=DateUtilsAll.dateToStringShort(new Date())%>" /></td>
			</tr>
			<tr>
				<td align="right">附件：</td>
				<td align="left"><input type="hidden" id="FUJIAN" name="FUJIAN" />
					<jsp:include
						page="../fileupload/attachment.jsp?id=${shebeifengcun.ID }&column=FUJIAN&show=n"></jsp:include>
				</td>
			</tr>
			<tr>
				<td align="right">设备状态描述：</td>
				<td align="left">
					<div class="div">
						<textarea rows="5" cols="100" id="ZHUANGTAI" name="ZHUANGTAI"
							readonly="readonly" onkeydown="countlen1(this); "
							style="width: 250px;">${shebeifengcun.ZHUANGTAI}</textarea>
					</div>
				</td>
				<td align="right">原因描述：</td>
				<td align="left">
					<div class="div">
						<textarea rows="5" cols="100" id="YUANYIN" name="YUANYIN"
							readonly="readonly" onkeydown="countlen1(this);"
							style="width: 250px;">${shebeifengcun.YUANYIN}</textarea>
					</div>
				</td>
			</tr>
			<tr>


			</tr>

			<tr>
				<td align="right">审批人 ：</td>
				<td align="left"><input type="text" id="SHENPIREN"
					maxlength="50" name="SHENPIREN"
					style="border: 1px solid #999;padding: 5px;width: 250px;height:25px;"
					value="<%=session.getAttribute("username")%>" /></td>
				<td align="right">审批意见：</td>
				<td align="left">
					<div class="div">
						<textarea rows="5" cols="100" id="SHENPIYIJIAN"
							name="SHENPIYIJIAN" onkeydown="countlen1(this);"
							style="width: 250px;"></textarea>
					</div>
				</td>
			</tr>
			<tr>
				<td align="right">审批日期 :</td>
				<td align="left"><input type="text" id="SHENPIDATE"
					maxlength="50" name="sqDate"
					style="border: 1px solid #999;padding: 5px;width: 250px;height:25px;"
					value="<%=DateUtilsAll.dateToStringShort(new Date())%>" />
			</tr>

		</table>
		<table width="100%" border="0" align="center" class="formTableNew">
			<tr>
				<td align="center"><input id="saveBtn" type="button"
					value="提 交" class="form_bt_orange" /> <input id="backBtn"
					<input type="button" id="closeBtn" value="取 消" class="form_bt_grey" />
				</td>
			</tr>
		</table>
		<!--表单结束-->
	</form>
</body>
</html>
